#pragma once
#include "stdafx.h"
#include "FbxIO.h"
#include "FbxRenamingStrategy.h"
#include "kfbxio/kfbxexporter.h"

namespace Skill
{
	namespace FbxSDK
	{
		ref class FbxDocument;	
		ref class FbxString;
		ref class FbxSdkManager;
		ref class FbxClassId;
		namespace IO
		{	
			ref class FbxStreamOptions;


			public enum class FileFormat : int
			{
				FbxBinary = 0,
				FbxAscii = 1,
				FbxEncrypted = 2,
				Fbx5Binary = 3,
				Fbx5Ascii = 4,
				AutocadDXF = 5,
				StudioMax3DS = 6 ,
				AliasOBJ = 7,
				ColladaDAE = 8
			};			

			/** \brief Class to export SDK objects into an FBX file.
			*
			* \nosubgrouping
			*	Typical workflow for using the KFbxExporter class:
			*		-# create an exporter
			*		-# initialize it with a file name
			*		-# set numerous states, take information, defining how the exporter will behave
			*		-# call KFbxExporter::Export() with the entity to export
			*/
			public ref class FbxExporter : FbxIO
			{
				REF_DECLARE(FbxEmitter,KFbxExporter);
			internal:
				FbxExporter(KFbxExporter* instance) : FbxIO(instance)
				{
					_Free = false;
				}

				FBXOBJECT_DECLARE(FbxExporter);								
				
			public:

				virtual void CollectManagedMemory() override;

				/** Initialize object.
				*	\param pFileName     Name of file to access.
				*	\return              \c true on success, \c false otherwise.
				* \remarks             To identify the error that occured, call KFbxIO::GetLastErrorID().
				*/
				virtual bool Initialize(String^ fileName) override;


				/** Get file export options settings.
				*	\return     Pointer to file export options or NULL on failure.
				* \remarks    Caller gets ownership of the returned structure.
				*/				
				REF_PROPERTY_GET_DECLARE(FbxStreamOptions,ExportOptions);				

				/** Export the document to the currently created file.
				* \param pDocument          Document to export.
				* \param pStreamOptions     Pointer to file export options.
				*	\return                   \c true on success, \c false otherwise.
				* \remarks                  To identify the error, call KFbxIO::GetLastErrorID().
				*/
				bool Export(FbxDocument^ document, FbxStreamOptions^ streamOptions);
				bool Export(FbxDocument^ document);

				/** Release the file export options. 
				* \param pStreamOptions     Pointer to file export options.
				*/
				void ReleaseExportOptions(FbxStreamOptions^ streamOptions);

				//@}

				/** 
				* \name File Format
				*/
				//@{

				
				/** Get the format of the exported file.
				*	\return     File format identifier.
				*/
				/** Set the exported file format.
				*	\param pFileFormat     File format identifier.
				*/
				VALUE_PROPERTY_GETSET_DECLARE(int,FileFormat);				

				/** Return     \c true if the file format is a recognized FBX format.
				*/
				VALUE_PROPERTY_GET_DECLARE(bool,IsFBX);				

				/** Get writable version for the current file format.
				* \return     \c char**
				*/				
				//array<String^>^ GetCurrentWritableVersions();				

				/** Set file version for a given file format.
				* \param pVersion        String description of the file format.
				* \param pRenamingMode   Renaming mode.
				* \return                \c true if mode is set correctly
				*/
				bool SetFileExportVersion(FbxString^ version, FbxSceneRenamer::RenamingMode renamingMode);

				/** Set the resampling rate (only used when exporting to FBX5.3 and lower)
				* \param     pResamplingRate resampling rate
				*/
				//void SetResamplingRate(double resamplingRate);								


				///////////////////////////////////////////////////////////////////////////////
				//
				//  WARNING!
				//
				//	Anything beyond these lines may not be documented accurately and is 
				// 	subject to change without notice.
				//
				///////////////////////////////////////////////////////////////////////////////

#ifndef DOXYGEN_SHOULD_SKIP_THIS

				/** Get file export option settings.
				* \param pFbxObject     Target FBX file.
				*	\return               Pointer to stream export options or NULL on failure.
				* \remarks              Caller gets ownership of the returned structure.
				*/	
				//FbxStreamOptions^ GetExportOptions(KFbx* pFbxObject);

				/** Export the document to a FBX file.
				* \param pDocument          Document to export.
				* \param pStreamOptions     Pointer to stream export options, not publicly available yet.
				* \param pFbxObject         Target FBX file.
				*	\return                   \c true on success, \c false otherwise.
				* \remarks                  To identify the error, call KFbxIO::GetLastErrorID().
				*/
				//bool Export(FbxDocument^ %document, FbxStreamOptions^ %streamOptions, KFbx* pFbxObject);			

#endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS

			};

		}
	}
}